﻿using System;
using System.Collections.Generic;
using System.Text;
using Maticsoft.DBUtility;
using System.Data;
using System.Data.SqlClient;

namespace YY.DAL
{
    public class MainHelp
    {
        public int ExecuteSql(string strSql)
        {
            return DbHelperSQL.ExecuteSql(strSql);
        }

        /// <summary>
        /// 执行SQL语句，返回影响的记录数
        /// </summary>
        /// <param name="SQLString">SQL语句</param>
        /// <returns>影响的记录数</returns>
        public int ExecuteSql(string SQLString, params SqlParameter[] cmdParms)
        {
            return DbHelperSQL.ExecuteSql(SQLString, cmdParms);
        }

        public DataSet Query(string strSql)
        {
            return DbHelperSQL.Query(strSql);
        }
        public DataSet RunProcedure(string strSql, IDataParameter[] parameters)
        {
            return DbHelperSQL.RunProcedure(strSql, parameters, "Battlefield");
        }

        public int ExecuteSqlTran(List<string> SQLStringList)
        {
            return DbHelperSQL.ExecuteSqlTran(SQLStringList);
        }

    

        //public int ExecuteSqlTran(List<string> SQLStringList, out List<int> IDENTITYs)
        //{
        //    return DbHelperSQL.ExecuteSqlTran(SQLStringList,out IDENTITYs);
        //}

        //public int ExecuteSqlTran(List<string> SQLStringList, ref SqlConnection sqlconnection, ref SqlTransaction sqltransaction)
        //{
        //    return DbHelperSQL.ExecuteSqlTran(SQLStringList, ref sqlconnection, ref sqltransaction);
        //}
        //跨数据库操作
        public DataSet Query(string strSql, string connectionString)
        {
            return new DbHelperSQLP(connectionString).Query(strSql);
        }

        public object GetSingle(string strSql)
        {
            return DbHelperSQL.GetSingle(strSql);
        }
        
    }
}
